package uy.com.csi.gestpro.datamodel;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;
import uy.com.csi.gestpro.model.mantenimiento.GpEmprsa;

public class EmpresaDM extends ListDataModel<GpEmprsa> implements SelectableDataModel<GpEmprsa>, Serializable {
	
	private static final long serialVersionUID = 1L;
	private List<GpEmprsa> idList;
	
	public EmpresaDM(){
	}

	public EmpresaDM(List<GpEmprsa> idList){
		super(idList);
		this.idList = idList;
	}
	
	public GpEmprsa getRowData(String rowKey) {
		Integer rk = Integer.parseInt(rowKey);
		for(GpEmprsa id : idList){
			if(id.getId().compareTo(rk)==0){
				return id;
			}
		}
		return null;
	}
	
	public Object getRowKey(GpEmprsa infDi){
		return infDi.getId()+"";
	}
}
